package example.json.msg.util;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateUtils;
import java.text.SimpleDateFormat;
import java.util.*;
import static example.json.msg.conts.MsgConsts.*;
import static java.lang.Integer.*;

public class PhoneNumberUtil {

    /** 生成指定多个电话号码,用 , 分割 */
    public static String phone(int number){
        String result = "";
        Random random = new Random();
        for(int i=0;i<number;i++) {
            Long lNumber = MAX_PHONE_NUM - random.nextInt(MAX_VALUE);
            if (i==0) {
                result = lNumber + "";
            } else{
                result = result + "," + lNumber;
            }
        }
        return result;
    }

    @SuppressWarnings("all")
    public static String sendtime() {
        return sendtime(null);
    }

    @SuppressWarnings("all")
    public static String tommorrow() {
        return tommorrow(null);
    }

    @SuppressWarnings("all")
    public static String sendtime(String format){
        if(StringUtils.isEmpty(format))
            format = DEFAULT_FORMAT;
        return new SimpleDateFormat(format).format(new Date());
    }

    @SuppressWarnings("all")
    public static String tommorrow(String format){
        if(StringUtils.isEmpty(format))
            format = DEFAULT_FORMAT;
        return new SimpleDateFormat(format).format(DateUtils.addDays(new Date(), 1));
    }

    public static String uuid(){
        return UUID.randomUUID().toString().replace("-", ""); // 短信id，查询短信状态报告时需要，（可选）
    }
}
